package com.heima.admin.service.impl;

import com.heima.admin.service.AdChannelService;
import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.admin.dtos.ChannelDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
@Slf4j
@AllArgsConstructor
@NoArgsConstructor
public class AdChannelServiceImpl implements AdChannelService {

    @Autowired
    private IWemediaClient iWemediaClient;

    /**
     * 删除频道
     * @param id
     * @return
     */
    @Override
    public ResponseResult deleteChannel(Integer id) {
        return iWemediaClient.deleteChannel(id);
    }

    /**
     * 频道名称模糊分页查询
     * @param channelDto
     * @return
     */
    @Override
    public ResponseResult getChannelList(ChannelDto channelDto) {
        ResponseResult responseResult = iWemediaClient.getChannelList(channelDto);
        return responseResult;
    }

    /**
     * 保存频道
     * @param wmChannel
     * @return
     */
    @Override
    public ResponseResult saveChannel(WmChannel wmChannel) {
        return iWemediaClient.saveChannel(wmChannel);
    }

    /**
     * 修改频道
     * @param wmChannel
     * @return
     */
    @Override
    public ResponseResult updateChannel(WmChannel wmChannel) {
        return iWemediaClient.updateChannel(wmChannel);
    }
}
